<template>
    <!-- 回到顶部按钮组件 -->
    <div class="anchor-component-container" @click="scrollToTop()">
        <img src="../assets/images/anchor.png"/>
    </div>
</template>

<script>
    export default {
        methods: {
            scrollToTop: function () {
                // 使用jQuery
                $("body,html").animate({
                    scrollTop: 0
                }, 400);
            }
        }
    }
</script>

<style>
    .anchor-component-container {
        position: fixed;
        width: 2.5rem;
        height: 2.5rem;
        bottom: 4.0rem;
        right: 1.0rem;
    }

    .anchor-component-container img {
        width: 100%;
        height: 100%;
    }
</style>